﻿/*******************************************************************************
* Copyright (C) JuCheap
* 
* Author: JuCheap
* Create Date: 2019/11/23 10:02:10
* Description:  
* 
* Revision History:
* Date         Author               Description
*
*********************************************************************************/

using JuCheap.Core.Infrastructure.Extentions;
using System.Collections.Generic;

namespace JuCheap.Core.Model
{
    /// <summary>
    /// 前台菜单结构模型
    /// </summary>
    public class MenuResponseDto
    {
        /// <summary>
        /// Id/Key唯一标识
        /// </summary>
        public string Key { get; set; }
        /// <summary>
        /// 父节点Id
        /// </summary>
        public string ParentKey { get; set; }
        /// <summary>
        /// 图标
        /// </summary>
        public string Icon { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string Title { get; set; }
        /// <summary>
        /// 路径/url
        /// </summary>
        public string Path { get; set; }
        /// <summary>
        /// Value
        /// </summary>
        public string Value { get; set; }
        /// <summary>
        /// 选中
        /// </summary>
        public bool Selectable { get; set; }
        /// <summary>
        /// 是否是跳转(如果菜单路径以http开头，则默认是跳转到第三方网站)
        /// </summary>
        public bool Redirect => Path.IsNotBlank() && Path.StartsWith("http");
        /// <summary>
        /// 子节点
        /// </summary>
        public IList<MenuResponseDto> Children { get; set; }
    }
}
